{extend name="public/base" /}

{block name="title"}<title>列表</title>{/block}

{block name="pjax_container"}
<style>
    tr>th,
    td {
        text-align: center;
    }



    .content-header>.breadcrumb>li {
        color: #999;
    }

    .content-header>.breadcrumb>.active {
        color: #666;
    }

    .content-header {
        height: 51px;

    }

    .btn-primary {
        background-color: #1890FF;
        color: #fff;
        border: none;
        border-radius: 6px !important;
        margin-left: 15px;
        padding: 5px 10px;
    }

    .box-primary {
        border-top-color: #ecf0f5 !important;
        border-top-width: 16px;

    }

    .btn-primary:hover {
        background-color: #1890FF !important;
        color: #fff;
        border: none;
        opacity: .9;
        border-radius: 6px !important;
    }

    .delete-one {
        background-color: ff4141 !important;
        margin-left: 15px;
        border-radius: 6px;
    }

    .sreachs {
        background-color: #1890FF;
        color: #fff;
        border: none;
        border-radius: 6px !important;
        margin-left: 15px;
        padding: 7px 15px;
    }
    .sreachs:hover{
       background-color: #1890FF;
    color: #fff;
    border: none;
    opacity: .8;
    border-radius: 6px !important;
    margin-left: 15px;
    padding: 7px 15px; 
}
    button{
        margin-left: 10px !important;
    }
     
    .form-group>input {
        border: none;
        height: 100%;
        border-bottom: 1px solid #ccc;
    }
</style>
<section class="content-header">
    <h1>财务统计</h1>
    <ol class="breadcrumb">
        <li>报表统计</li>
        <li class="active">财务统计</li>
    </ol>
</section>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">

                <div class="box-tools" style="margin:5px;">
                    <form id="form1" action="{:search_url(['create_time', 'create_time2', 'year_month'])}" method="GET" pjax-search="">
                        <div class="input-group input-group-sm">
                            <input type="hidden" name="page" value="1" />
                            <div>
                                <label style="margin-bottom:0;" for="">时间</label>
                                <input class="timepicker" style="transform: scaleY(1.1); border: 1px solid #ccc;" name="create_time" value="{:input('get.create_time')}" placeholder="" AUTOCOMPLETE="off">
                                <label style="margin-bottom:0;" for="">至</label>
                                <input class="timepicker" style="transform: scaleY(1.1); border: 1px solid #ccc;" name="create_time2" value="{:input('get.create_time2')}" placeholder="" AUTOCOMPLETE="off">
                                <div class="input-group-btn" style="display: inline-block;">

                                    <button type="submit" class="btn btn-default sreachs">
                                        <i class="fa fa-search"></i>查询
                                    </button>

                                    <button type="button" class="btn btn-default sreachs" onclick="year_month(1)">
                                        本年
                                    </button>
                                    <button type="button" class="btn btn-default sreachs" onclick="year_month(2)">
                                        本季
                                    </button>
                                    <button type="button" class="btn btn-default sreachs" onclick="year_month(3)">
                                        本月
                                    </button>

                                </div>
                            </div>
                        </div>
                    </form>
                </div>

                财务统计收入：<h3 style="display:inline-block;">{$total_price}</h3>

                <div class="box-header with-border">
                    <div class="pull-left">
                        <a href="javascript:xls_explode();" target="_blank" class="btn btn-sm btn-primary"> 导出</a>
                    </div>
                </div>
                <div class="box-body table-responsive">
                    <table class="table table-bordered table-hover">
                        <tr>
                            <th width="35"><input type="checkbox" class="minimal checkbox-toggle"></th>
                            <th>企业名称</th>
                            <th>企业账号</th>
                            <th>所在地区</th>
                            <th>公司电话</th>
                            <th>负责人</th>
                            <th>移动电话</th>
                            <th>创建时间</th>
                            <th>收费金额</th>
                        </tr>
                        {volist name="$list" id="v"}
                        <tr>
                            <td><input type="checkbox" name="id[]" value="{$v.id}" class="minimal checkbox"></td>
                            <td>{$v["name"]}</td>
                            <td>{$v["account"]}</td>
                            <td>
                                {$region_list[$v['province_id']]|default=''}-
                                {$region_list[$v['city_id']]|default=''}-
                                {$region_list[$v['area_id']]|default=''}
                            </td>
                            <td>{$v["com_mobile"]}</td>
                            <td>{$v["principal"]}</td>
                            <td>{$v["mobile"]}</td>
                            <td>{:date('Y-m-d H:i:s', $v["create_time"])}</td>
                            <td>{$v["price"]}</td>
                        </tr>
                        {/volist}
                    </table>
                </div>
                <div class="box-footer clearfix">
                    {$list->render()}
                </div>
            </div>
        </div>
    </div>
</section>
<script>
    $(function(){

        $(".select2").select2({language:"zh-CN"});

        // 列表部分 全选
        $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
            checkboxClass: 'icheckbox_minimal-blue',
            radioClass: 'iradio_minimal-blue'
        });
        $('.checkbox-toggle').on('ifChecked', function(event){
            var _this = $(this);
            var _table = _this.closest('.table');
            _table.find("tr td input[type='checkbox']").iCheck("check");
        });
        $('.checkbox-toggle').on('ifUnchecked', function(event){
            var _this = $(this);
            var _table = _this.closest('.table');
            _table.find("tr td input[type='checkbox']").iCheck("uncheck");
        });


        $('.timepicker').datetimepicker({
            format: "{$timepickerFormat | default='YYYY-MM-DD'}",   //YYYY-MM-DD HH:mm:ss
            locale: moment.locale('zh-cn')
        });
    });

    //xlsd导出
    function xls_explode() {
        window.location.href = "{:url('Toll/finance')}?" + $('#form1').serialize()+"&export=1&year_month={:input('year_month')}";
        return false;
    }
    
    //年季月筛选
    function year_month(t) {
        window.location.href = "{:url('Toll/finance')}?" + 'year_month='+t;
        return false;
    }
</script>
{/block}
